package com.cecw.Utils;


import com.cecw.pojo.Project;
import java.text.DecimalFormat;

/**
 * @author linlingxin
 * @date 2024/5/24 15:41
 */
public class CalScoreUtil {
    public static Project calScore(Project project){
        int bug = project.getBug();
        int vulnerability = project.getVulnerability();
        int blocker = project.getBlocker();
        int critical = project.getCritical();
        int major = project.getMajor();
        int nCloc = project.getnCloc();
        DecimalFormat dF = new DecimalFormat("0.0000");
        String score = dF.format((double) (bug*10+vulnerability*5+blocker*3+critical*2+major)/nCloc);
        project.setScore(1-Double.valueOf(score));
        return project;
    }
}
